<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>

</head>

<body>

</body>
<script>
    const pm = new Promise((resolved, rejected) => {
        $.ajax({
            type: "get",
            url: "http://39.104.16.173:8081/area/hot",
            success: (res) => {
                resolved(res.body)
            },
            err: (err) => {
                let data = {
                    msg: "获取数据失败",
                    err: err
                }
                rejected(data)
            }
        })
    })

    pm.then(res => {
        console.log(res);
        let id = res[0].value;
        return new Promise((resolved,rejected) => {
            $.ajax({
                type: "get",
                url: "http://39.104.16.173:8081/area",
                data: {
                    id: id
                },
                success: (res) => {
                    resolved(res.body)
                },
                err: (err) => {
                    let data = {
                        msg: "获取数据失败",
                        err: err
                    }
                    rejected(data)
                }
            })
        })
    }).then(res=>{
        console.log(res);
    })

</script>

</html>